package com.cloud.pikachu.storage.api.feign;

import com.cloud.pikachu.storage.api.feign.config.FeignSupportConfig;
import com.cloud.pikachu.storage.api.feign.hihystric.ImageUploadClientHiHystric;
import com.cloud.pikachu.storage.api.vo.ExecuteResult;
import com.cloud.pikachu.storage.api.vo.UploadImageVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 图片上传Feign
 *
 * @author : ABug
 * @Date : 2019/5/20 10:01
 * @UpdateDate : 2019/5/20 10:01
 * @Version V1.0.0
 **/
@FeignClient(name="pikachu-public-image-storage-service" , fallback = ImageUploadClientHiHystric.class,configuration = FeignSupportConfig.class)
public interface ImageUploadClient {

    @RequestMapping(value = "/uploadImage" , method = RequestMethod.POST)
    public ExecuteResult<UploadImageVO> uploadVersion(@RequestParam(value = "file") MultipartFile file,
                                                      @RequestParam(value = "saveType" , required = false , defaultValue= "4") int saveType,
                                                      @RequestParam(value = "saveDuration" , required = false , defaultValue= "0") long saveDuration,
                                                      @RequestParam(value = "sliceList" , required = false) List<String> sliceList,
                                                      @RequestParam(value = "zipType" , required = false , defaultValue = "0") int zipSize,
                                                      @RequestHeader(value = "code" , required = false , defaultValue = "") String code);
}
